﻿
Public Class operateByTag
    Public Const functionName As String = "opBTG"

    Public Shared Sub invoke(ByVal inlineScript As inlineScript, ByVal oper As String _
                             , ByVal tag As String, ByVal para As String, ByRef actionTarget As String _
                             , Optional ByVal operOverride As String = Nothing)
        assert(Not inlineScript Is Nothing, "inlineScript is nothing.")
        assert(Not isemptystring(tag), "tag is an empty string.")
        assert(Not isemptystring(oper), "oper is an empty string.")
        assert(Not isemptystring(para), "para is an empty string.")
        If isemptystring(operOverride) Then
            operOverride = oper
        End If
        inlineScript.addscript(network.http.contentType.textjavascript, "operatorByTag_" + oper _
                                 , "function " + functionName + "_" + operOverride + "(t,p)" _
                                 + "{" + _
                                 operate.invoke(inlineScript, oper, _
                                                "document.getElementsByTagName(i)", "p", , _
                                                operOverride) + _
                                 ";}")
        actionTarget += functionName + "_" + operOverride + "(" + tag + "," + para + ")"
    End Sub
End Class

Public Class disableByTag
    Public Const functionName As String = "disBTG"

    Public Shared Sub invoke(ByVal inlineScript As inlineScript, ByVal tag As String, ByRef actionTarget As String)
        operateByTag.invoke(inlineScript, "disabled", tag, "true", actionTarget, "dis")
    End Sub
End Class

Public Class changeInnerHtmlByTag
    Public Const functionName As String = "chgIHBTG"

    Public Shared Sub invoke(ByVal inlineScript As inlineScript, ByVal tag As String, ByVal value As Object _
                             , ByRef actionTarget As String)
        operateByTag.invoke(inlineScript, "innerHTML", tag, Convert.ToString(value), actionTarget, "ih")
    End Sub
End Class

Public Class changeInnerHtmlAndDisableByTAG
    Public Const functionName As String = "cIHdBTG"

    Public Shared Sub invoke(ByVal inlineScript As inlineScript, ByVal tag As String, ByVal value As Object _
                             , ByRef actionTarget As String)
        disableByTag.invoke(inlineScript, tag, actionTarget)
        actionTarget += ";"
        changeInnerHtmlByTag.invoke(inlineScript, tag, value, actionTarget)
    End Sub
End Class
